package com.jie.server.modules.platform.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jie.server.modules.platform.entity.TenantPackage;
import com.jie.server.modules.platform.mapper.TenantPackageMapper;
import com.jie.server.modules.platform.service.ITenantPackageService;
import com.jie.server.modules.platform.vo.SimplePackage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @description: 租户套餐表Service业务层处理
 * @author: xiaojie
 * @since: 2024/12/13 0013
 */
@Service
public class TenantPackageServiceImpl extends ServiceImpl<TenantPackageMapper, TenantPackage> implements ITenantPackageService {

    @Autowired
    private TenantPackageMapper tenantPackageMapper;

    /**
     * 查询租户套餐表
     * @param packageId 租户套餐表主键
     * @return 租户套餐表
     */
    @Override
    public TenantPackage selectTenantPackageByPackageId(Long packageId) {
        return tenantPackageMapper.selectTenantPackageByPackageId(packageId);
    }

    /**
     * 查询租户套餐表列表
     * @param tenantPackage 租户套餐表
     * @return 租户套餐表
     */
    @Override
    public List<TenantPackage> selectTenantPackageList(TenantPackage tenantPackage) {
        return tenantPackageMapper.selectTenantPackageList(tenantPackage);
    }

    /**
     * 新增租户套餐表
     * @param tenantPackage 租户套餐表
     * @return 结果
     */
    @Override
    public boolean create(TenantPackage tenantPackage) {
        return save(tenantPackage);
    }

    /**
     * 修改租户套餐表
     * @param tenantPackage 租户套餐表
     * @return 结果
     */
    @Override
    public boolean update(TenantPackage tenantPackage) {
        return updateById(tenantPackage);
    }

    /**
     * 批量删除租户套餐表
     * @param packageIds 需要删除的租户套餐表主键
     * @return 结果
     */
    @Override
    public int deleteTenantPackageByPackageIds(Long[] packageIds) {
        return tenantPackageMapper.deleteBatchIds(Arrays.asList(packageIds));
    }

    /**
     * 删除租户套餐表信息
     * @param packageId 租户套餐表主键
     * @return 结果
     */
    @Override
    public int deleteTenantPackageByPackageId(Long packageId) {
        return tenantPackageMapper.deleteById(packageId);
    }

    /**
     * 查询租户套餐
     * @return 租户套餐
     */
    @Override
    public List<SimplePackage> getSimpleList() {
        return tenantPackageMapper.getSimpleList();
    }

}
